The present disclosure is directed to dynamic class loading, and more particularly to dynamic class loading during computer program execution.
In modern programming languages different methods exist to dynamically load interdependent components of an executable code for an application. An example of a programming language is the Java™ programming language, which is an object oriented programming language. In the Java™ programming language the interdependent component refers to a class. An object or an instance may be created or instantiated from a class. In Java™, when the program requests a specific object, a class loader dynamically loads a class in order to instantiate the requested object from the class. The class loader may load files relating to both the class and the way of implementing the class in the application. These files are called .jar files. A class generally refers to one or more referenced classes. When a referenced class is to be loaded, a specific Java™ dedicated delegation policy, called parent first, may apply to the class loader. Indeed, the class loader used to load any referenced class of a given class is the same used to load the parent class itself. In addition, the parent first delegation policy means that when a class loader is requested to load a given class the class loader first delegates to its parent class loader the loading of the class. If there is a failure in the loading of the class by the parent class loader, then the class loader of the parent class will try to load the referenced class itself.
A referenced class may correspond to a class which belongs to a third party library, which means that the corresponding .jar files are external files unknown by the class loader of the application. Thus, when executing the loading of a referenced class belonging to a third party library, the class loader refers to the parent class of the referenced class before loading the referenced class. However, as the class loader relates to the application, the class loader does not know how to access the .jar file relating to the referenced class belonging to a third party library.